<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>设备控制面板</title>
  <link rel="stylesheet" href="style.css">
</head>
<style>
    /* 设置页面基础字体 */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f4f4f4;
}

/* 容器布局 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background-color: white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}

h1 {
  text-align: center;
  color: #333;
  margin-bottom: 30px;
}

/* 主内容区域，使用 flex 布局 */
.main-content {
  display: flex;
  justify-content: space-between;
  gap: 30px;
}

/* 每个部分的布局 */
.section, .section1 {
  width: 48%;
}

h2 {
  color: #333;
  margin-bottom: 15px;
}

/* 控制按钮的样式 */
.control-btns form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.text {
  font-size: 16px;
  color: #555;
}

/* 自定义开关按钮样式 */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  border-radius: 50%;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
}

/* 开关激活状态的样式 */
input:checked + .slider {
  background-color: #4caf50;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* 响应式设计：当屏幕宽度较小（如手机）时，改为垂直堆叠 */
@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
    gap: 20px;
  }

  .section, .section1 {
    width: 100%;
  }

  .control-btns form {
    flex-direction: column;
    align-items: flex-start;
  }

  .text {
    margin-bottom: 10px;
  }

  .slider {
    margin-top: 10px;
  }
}

    </style>
<body>
  <div class="container">
    <h1>控制面板</h1>

    <!-- 设备控制区 -->
    <div class="section control-btns">
      <h2>设备控制</h2>
      <form>
        <span class="text">加热片控制</span>
        <label class="switch">
          <input type="checkbox" id="heat-control" />
          <span class="slider"></span>
        </label>
      </form>

      <form>
        <span class="text">制冷片控制</span>
        <label class="switch">
          <input type="checkbox" id="cool-control" />
          <span class="slider"></span>
        </label>
      </form>

      <form>
        <span class="text">空调控制</span>
        <label class="switch">
          <input type="checkbox" id="kong-control" />
          <span class="slider"></span>
        </label>
      </form>

      <form>
        <span class="text">蜂鸣器控制</span>
        <label class="switch">
          <input type="checkbox" id="buzzer-control" />
          <span class="slider"></span>
        </label>
      </form>
    </div>

    <!-- 自动化控制区 -->
    <div class="section control-btns">
      <h2>自动化控制</h2>
      <form>
        <span class="text">通风系统控制</span>
        <label class="switch">
          <input type="checkbox" id="vent-control" />
          <span class="slider"></span>
        </label>
      </form>

      <form>
        <span class="text">自动灌溉</span>
        <label class="switch">
          <input type="checkbox" id="auto-irrigation" />
          <span class="slider"></span>
        </label>
      </form>

      <form>
        <span class="text">自动施肥</span>
        <label class="switch">
          <input type="checkbox" id="auto-fertilization" />
          <span class="slider"></span>
        </label>
      </form>

      <form>
        <span class="text">二氧化碳浓度控制</span>
        <label class="switch">
          <input type="checkbox" id="co2-control" />
          <span class="slider"></span>
        </label>
      </form>

      <form>
        <span class="text">氧气浓度控制</span>
        <label class="switch">
          <input type="checkbox" id="oxygen-control" />
          <span class="slider"></span>
        </label>
      </form>
    </div>
  </div>
</body>
</html>
